/*
 * CodeSaveCommand.java
 *
 * Created on 2006년 3월 29일 (수), 오후 4:11
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package com.welfare.admin.call;

import java.util.*;






import javax.servlet.*;
import javax.servlet.http.*;

import org.json.simple.JSONObject;

import com.zll.framework.model.HashBox;
import com.zll.framework.model.HashList;
import com.zll.framework.servlet.Command;
import com.zll.framework.util.StringUtil;





/**
 *
 * @author eastar
 */
public class CounselSaveCommand implements Command
{
    public String execute(HttpServletRequest  request, HttpServletResponse response)
    throws Exception
    {
    	HashBox box = new HashBox(request);
    	
    	JSONObject json = new JSONObject();
    	
    	if ("".equals(box.get("reg_user"))) {
    		json.put("result_code", "SESSION_TIMEOUT");
    	}
		else {
			CallDAO dao = new CallDAO();
	    	dao.saveCounsel(box);
		}
    	
    	request.setAttribute("jsonData", json.toString());
    	
    	
//    	if ("C".equals(box.get("job_type"))) {
//    		
//    	}
//    	else {
//    		HashMap result		= new HashMap();
//    		if ("".equals(box.get("reg_user"))) {
//    			result.put("result", 	"false");
//    			result.put("target", 	"_opener");
//    			result.put("action",	"SESSION_TIMEOUT");
//    		}
//    		else {
//    			
//    		}
//    	}
//    	
//
//    	CallDAO dao 		= new CallDAO();
//
//    	dao.saveCounsel(box);
//
//
//    	
//    	
//    	HashMap result		= new HashMap();
//		result.put("result", 	"true");
//		
//		if ("D".equals(box.get("job_type"))) {
//			result.put("target", 	"_opener");
//			result.put("action",	"RELOAD_COUNSEL_LIST");
//		} else if ("C".equals(box.get("job_type"))) {
//			JSONObject json = new JSONObject();
//
//        	request.setAttribute("jsonData", json.toString());
//		} else {
//			result.put("action",	"./counselInfo.jsp?counsel_id=" + box.get("counsel_id"));
//		}
//
//    	request.setAttribute("result", result);

    	
    	
    	
    	return "/common/json_view.jsp";
    }
}
